import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// 导入i18n
import i18n from './lang/index';
// 路由守卫
import './router/permision';

Vue.use(ElementUI);

Vue.config.productionTip = false;

let userInfo = localStorage.getItem('userInfo');
if (userInfo) {
  // 有本地存储信息，去存到vuex中（不然刷新又需要登录）
  let obj = JSON.parse(userInfo);
  store.commit("login/setUserInfo", obj);
}

new Vue({
  router,
  store,
  // 挂载
  i18n,
  render: h => h(App)
}).$mount('#app')
